Skip to content

Honor exact C# names over back-compat naming - #11663

Draft
Jorge Rangel (jorgerangel-msft) with Copilot wants to merge 6 commits into
mainfrom
copilot/microsoft-11640-consider-exact-override-naming
Draft

Honor exact C# names over back-compat naming#11663
Jorge Rangel (jorgerangel-msft) with Copilot wants to merge 6 commits into
mainfrom
copilot/microsoft-11640-consider-exact-override-naming

Conversation

Copilot AI commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Names explicitly configured with exact could be replaced by names restored from the previous contract. This made advanced client naming overrides ineffective when back compatibility was enabled.

  • Naming precedence

    • Preserve exact names for service parameters and property-derived model factory parameters.
    • Continue restoring last-contract names for non-exact parameters.
  • Model factories

    • Treat exact-name-only differences as compatible signatures.
    • Avoid generating duplicate back-compat overloads.
  • Coverage

    • Add regression cases for RestClient and model factory naming paths.
@clientName(Azure.ClientGenerator.Core.exact("api_key"), "csharp")
apiKey: string;

The generated C# parameter remains api_key, even when the previous contract used another name.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
1 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com>
@microsoft-github-policy-service microsoft-github-policy-service Bot added the emitter:client:csharp Issue for the C# client emitter: @typespec/http-client-csharp label Aug 13, 2026
Copilot AI changed the title [WIP] Consider having exact override back compat naming Honor exact C# names over back-compat naming Aug 13, 2026
@pkg-pr-new

pkg-pr-new Bot commented Aug 19, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@typespec/http-client-csharp@11663

commit: f86f70e

Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Ensures exact C# parameter names take precedence over names restored from previous contracts.

Changes:

  • Skips back-compat renaming for exact service and property-derived parameters.
  • Prevents duplicate model factory compatibility overloads.
  • Adds regression tests for RestClient and model factory paths.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
.../test/Providers/TypeProviderTests.cs Tests exact-name precedence.
.../BuildMethodsForBackCompatibilityExactNameTakesPrecedence(Last)/TestClient.cs Defines the prior contract fixture.
.../BuildMethodsForBackCompatibilityExactNameTakesPrecedence.cs Captures expected exact-name output.
.../BackCompatibility_ExactPropertyNameTakesPrecedence(Last)/SampleNamespaceModelFactory.cs Defines the prior model factory contract.
.../BackCompatibility_ExactPropertyNameTakesPrecedence.cs Captures expected model factory output.
.../ModelFactoryProviderTests.cs Tests mixed exact and restored property names.
.../Utilities/BackCompatHelper.cs Excludes exact parameters from name restoration.
.../Providers/ParameterProvider.cs Exposes exact-name metadata for parameters.
.../Providers/ModelFactoryProvider.cs Treats exact-name differences as compatible.
.../ExactParameterNameTakesPrecedenceOverLastContractView(Last)/TestClient.cs Defines the prior RestClient contract.
.../ExactParameterNameTakesPrecedenceOverLastContractView.cs Captures expected RestClient output.
.../RestClientProviderTests.cs Adds RestClient naming regression coverage.
.../RestClientProvider.cs Prevents last-contract names overriding exact names.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot pull latest from main and address the merge conflicts

Comment thread .chronus/changes/csharp-exact-name-back-compat-2026-8-19-0-0-0.md Outdated
Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 24 out of 24 changed files in this pull request and generated no new comments.

Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com>

Copilot AI commented Aug 21, 2026

Copy link
Copy Markdown
Contributor Author

Copilot pull latest from main and address the merge conflicts

Merged the latest main and resolved the overlapping model-provider test conflict in merge commit 73521eaa8, retaining both regressions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

emitter:client:csharp Issue for the C# client emitter: @typespec/http-client-csharp

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consider Having Exact Override Back Compat Naming

3 participants